<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>vue</title>
</head>
<script src="vue.js"></script>


<body>

    <div id="app">
        <hd-news></hd-news>
        <hr>
        <hd-news></hd-news>
    </div>

<script type="text/x-template" id="hdNews">
    <div>
        <li v-for="(v,k) in news">
            {{v.title}}
            <button @click="del(k)">删除</button>
        </li>
    </div>

</script>
<script>
    var data={
        news:[
            {title:'前端申'},
            {title:'后端君'}

        ]
    };

    var hdNews={
        template:'#hdNews',
        data(){
            return{
                news:[
                    {title:'前端申'},
                    {title:'后端君'}

                ]
            };

        },
        methods:{
            del(k){
                this.news.splice(k,1);
            }
        }
    };
    var app=new Vue({
        el:'#app',
        components:{
          hdNews:hdNews
        },



    });

</script>
</body>
</html>